package com.shxt.service;

import java.util.Map;

import org.apache.ibatis.session.SqlSession;

import com.shxt.data.AdminMapper;
import com.shxt.pojo.Admin;

public class AdminService implements AdminMapper {
	
	private static AdminService instance = null;
	
	public static AdminService getInstance(){
		if(instance==null){
			instance = new AdminService();
		}
		return instance;
	}

	@Override
	public Admin validateAdmin(Map<String,String> mss) {
		Admin admin = new Admin();
		SqlSession session = MyFactory.sessionFactory().openSession();
		try{
			AdminMapper ad = session.getMapper(AdminMapper.class);
			admin = ad.validateAdmin(mss);
		}finally{
			if(session!=null){
				session.close();
			}
		}
		return admin;
	}

}
